<?php 
	
    header('HTTP/1.1 200 OK');
    
	  error_reporting(E_ALL); // выводим все ошибки
	  session_start();
  		
  	//include core files
    chdir('/home/www/z182452/htdocs/');
  	include("./cfg/connect.inc.php");
  	include("./includes/database/mysql.php");
    chdir('/home/www/z182452/htdocs/grabber');
  
  	//connect to the database
  	db_connect(DB_HOST,DB_USER,DB_PASS) or die (db_error());
  	db_select_db(DB_NAME) or die (db_error());
    db_query("SET NAMES 'utf8';") or die(db_error());
    try{ 
        $word = rawurldecode($_POST["word"]);
        $i_str = "INSERT INTO grab_useless(words) VALUES('$word');";
        db_query($i_str) or ThrowMe(db_error(),0);        
        echo 'deleted'; 

    }catch(Exception $e){ 
        echo $e->getMessage() ."\n"; 
    } 
    
    function ThrowMe($mess, $code){
        throw new Exception($mess, $code);
    }
    echo "ok";
?>